/* 热点创作编辑器 - 移动端优化样式 */

/* 移动端头部固定 */
.mobile-editor-header {
  position: sticky;
  top: 64px; /* 主导航栏高度 */
  z-index: 40;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 移动端底部操作栏 */
.mobile-editor-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 50;
}

/* iOS安全区域适配 */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 12px);
}

/* 移动端布局调整 */
@media (max-width: 768px) {
  .hot-creator-editor {
    padding: 0;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* 头部优化 */
  .editor-header {
    margin-bottom: 0;
    padding: 12px !important;
    border-radius: 0 !important;
    position: sticky;
    top: 64px;
    z-index: 40;
    flex-shrink: 0;
  }

  .editor-header .ant-typography-h3 {
    font-size: 16px !important;
    margin: 0 !important;
  }

  .editor-header .ant-space {
    width: 100%;
    flex-direction: column;
    gap: 8px !important;
  }

  .editor-header .ant-space-item {
    width: 100%;
  }

  .editor-header .ant-select {
    width: 100% !important;
  }

  .editor-header .ant-btn-group {
    width: 100%;
    display: flex;
  }

  .editor-header .ant-btn-group .ant-btn {
    flex: 1;
  }

  /* 内容区域 */
  .editor-content {
    margin-top: 0;
    padding: 8px !important;
    border-radius: 0 !important;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 140px !important; /* 为底部操作栏留出空间 */
  }

  /* Tab优化 */
  .editor-content .ant-tabs-nav {
    margin: 0;
  }

  .editor-content .ant-tabs-tab {
    padding: 8px 12px;
    font-size: 14px;
  }

  .editor-content .ant-tabs-tab .anticon {
    font-size: 14px;
  }

  /* 移动端使用垂直布局 */
  .editor-content .ant-row {
    flex-direction: column;
  }

  .editor-content .ant-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  .editor-content .ant-col:first-child {
    margin-bottom: 16px;
  }

  /* 卡片优化 */
  .editor-content .ant-card {
    border-radius: 8px;
    margin-bottom: 12px;
  }

  .editor-content .ant-card-head {
    padding: 12px 16px;
    min-height: auto;
  }

  .editor-content .ant-card-body {
    padding: 12px !important;
  }

  /* 输入区域优化 */
  .editor-content textarea {
    min-height: 200px !important;
    max-height: 300px !important;
    font-size: 14px;
  }

  .editor-content input {
    font-size: 16px; /* 防止iOS缩放 */
  }

  /* 生成内容区域 */
  .generated-content-area {
    min-height: 200px !important;
    max-height: 400px !important;
    padding: 8px !important;
  }

  /* 操作按钮栏 */
  .editor-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 !important;
    padding: 12px !important;
    border-radius: 0 !important;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
    z-index: 100;
    background: white;
  }

  .editor-actions .ant-row {
    flex-direction: column;
    gap: 8px;
  }

  .editor-actions .ant-col {
    width: 100%;
  }

  .editor-actions .ant-space {
    width: 100%;
    justify-content: space-between;
  }

  .editor-actions .ant-btn {
    flex: 1;
    min-height: 44px;
  }

  .editor-actions .ant-btn-primary {
    width: 100%;
  }

  /* Drawer和Modal优化 */
  .ant-drawer .ant-drawer-content-wrapper {
    width: 100% !important;
    max-width: 100vw !important;
  }

  .ant-modal {
    max-width: calc(100vw - 16px) !important;
    margin: 8px !important;
  }

  .ant-modal-body {
    padding: 12px !important;
    max-height: 60vh;
    overflow-y: auto;
  }

  /* 热点话题卡片 */
  .hot-topic-card {
    margin-bottom: 8px;
  }

  /* 质量评分卡片 */
  .quality-score-card .ant-row {
    gap: 8px;
  }

  .quality-score-card .ant-col {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Dropdown菜单优化 */
  .ant-dropdown-menu {
    max-width: 90vw;
    max-height: 70vh;
    overflow-y: auto;
  }

  .ant-dropdown-menu-item {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Tag优化 */
  .ant-tag {
    padding: 4px 8px;
    font-size: 12px;
    margin: 2px;
  }

  /* 进度条 */
  .ant-progress {
    margin-bottom: 8px;
  }

  /* Empty状态 */
  .ant-empty {
    padding: 20px 0;
  }

  .ant-empty-description {
    font-size: 14px;
  }

  /* 滚动条优化 */
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }

  /* Markdown内容 */
  .markdown-content {
    font-size: 14px;
    line-height: 1.6;
  }

  .markdown-content h1 {
    font-size: 20px;
  }

  .markdown-content h2 {
    font-size: 18px;
  }

  .markdown-content h3 {
    font-size: 16px;
  }

  .markdown-content pre {
    padding: 8px;
    font-size: 12px;
    overflow-x: auto;
  }

  .markdown-content table {
    font-size: 12px;
    overflow-x: auto;
    display: block;
  }
}

/* 平板优化 */
@media (min-width: 768px) and (max-width: 1024px) {
  .editor-content .ant-row {
    flex-wrap: wrap;
  }

  .editor-content .ant-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-bottom: 16px;
  }

  .editor-header .ant-select {
    width: 250px !important;
  }
}

/* 小屏幕手机 */
@media (max-width: 375px) {
  .editor-header .ant-typography-h3 {
    font-size: 14px !important;
  }

  .editor-header .ant-btn {
    padding: 4px 8px;
    font-size: 12px;
  }

  .editor-content .ant-tabs-tab {
    padding: 6px 8px;
    font-size: 12px;
  }

  .editor-actions .ant-btn {
    font-size: 14px;
  }
}

/* 触控优化 */
@supports (-webkit-touch-callout: none) {
  /* iOS设备 */
  .editor-content input,
  .editor-content textarea,
  .editor-content .ant-select-selector {
    font-size: 16px; /* 防止缩放 */
    -webkit-appearance: none;
  }

  .ant-btn,
  .ant-dropdown-menu-item {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
  .editor-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .editor-content {
    height: calc(100vh - 120px);
  }

  .generated-content-area {
    max-height: 250px !important;
  }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .hot-creator-editor {
    background: #141414;
  }

  .editor-header,
  .editor-content,
  .editor-actions {
    background: #1f1f1f;
    color: rgba(255, 255, 255, 0.85);
  }

  .generated-content-area {
    background: #141414;
    color: rgba(255, 255, 255, 0.85);
  }

  .markdown-content {
    color: rgba(255, 255, 255, 0.85);
  }

  .ant-card {
    background: #1f1f1f;
    border-color: #303030;
  }
}

/* 性能优化 */
@media (max-width: 768px) {
  /* 减少动画 */
  * {
    animation-duration: 0.2s !important;
  }

  /* 使用GPU加速 */
  .editor-content,
  .generated-content-area {
    transform: translateZ(0);
    will-change: scroll-position;
  }
}

/* 固定底部操作栏的安全区域（针对iPhone X及以上） */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .editor-actions {
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
  }
}

/* 打印样式 */
@media print {
  .editor-header,
  .editor-actions,
  .ant-tabs-nav {
    display: none !important;
  }

  .generated-content-area {
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    background: white !important;
  }

  .markdown-content {
    font-size: 12pt;
    line-height: 1.5;
  }
}